#pragma once

#include <kuadu.h>
#include "Panels/SceneHierarchyPanel.h"
#include <KuaDu/Events/KeyEvent.h>
#include "KuaDu/Renderer/EditorCamera.h"

namespace KD {

	class EditorLayer : public Layer
	{
	public:
		EditorLayer();
		virtual ~EditorLayer() = default;

		virtual void OnAttach() override;

		virtual void OnDetach() override;

		virtual void OnUpdate(TimeStep ts) override;

		virtual void OnEvent(Event& e) override;

		virtual void OnImGuiRender() override;
	private:
		void NewScene();
		void OpenScene();
		void OpenScene(const std::filesystem::path& path);
		void SaveSceneAs();
		bool OnKeyPressed(KeyPressedEvent& e);
		bool OnMouseButtonPressed(MouseButtonPressedEvent& e);
	private:
		EditorCamera m_EditorCamera;
		OrthographicCameraController m_CameraController;// ���������
		Ref<Framebuffer> m_Framebuffer;// ֡����
		Ref<Scene> m_ActiveScene;// ����

		Entity m_SquadEntity;// �ı���ʵ��
		Entity m_CameraEntity;// �����ʵ��
		Entity m_SecondCamera;// �ڶ����ʵ��
		Entity m_HoveredEntity;

		bool m_PrimaryCamera = true;//ѡ�������

		struct ProfileResult
		{
			const char* Name;
			float Time;
		};
		std::vector<ProfileResult> m_ProfileResults;

		glm::vec2 m_ViewportSize = { 1600, 900 };

		glm::vec2 m_ViewportBounds[2];

		//glm::vec4 m_SquareColor = { 0.2f, 0.3f, 0.8f, 1.0f };

		int m_GizmoType = -1;

		SceneHierarchyPanel m_SceneHierarchyPanel;//������νṹ���
	};

}